﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Spriest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            SpriestSettings.myPrefs.Load();

            comboBoxLifeblood.SelectedIndex = SpriestSettings.myPrefs.uselifeblood;
            comboBoxLifebloodYorN.SelectedIndex = SpriestSettings.myPrefs.lifebloodYorN;
            comboBoxTrinket1.SelectedIndex = SpriestSettings.myPrefs.trinket1;
            comboBoxTrinket2.SelectedIndex = SpriestSettings.myPrefs.trinket2;
            comboBoxEngiGloves.SelectedIndex = SpriestSettings.myPrefs.engigloves;
            comboBoxAlchemyFlask.SelectedIndex = SpriestSettings.myPrefs.alchemyflask;
            comboBoxPowerInfusionYorN.SelectedIndex = SpriestSettings.myPrefs.powerinfusion;
            comboBox1Powerinfusion.SelectedIndex = SpriestSettings.myPrefs.usepowerinfusion;
            comboBoxCascadeYorN.SelectedIndex = SpriestSettings.myPrefs.cascade;
            comboBoxCascade.SelectedIndex = SpriestSettings.myPrefs.usecascade;
            comboBoxDivineStarYorN.SelectedIndex = SpriestSettings.myPrefs.divinestar;
            comboBoxDivineStar.SelectedIndex = SpriestSettings.myPrefs.usedivinestar;
            comboBoxHaloYorN.SelectedIndex = SpriestSettings.myPrefs.halo;
            comboBox1Halo.SelectedIndex = SpriestSettings.myPrefs.usehalo;
            comboBoxInsanityYorN.SelectedIndex = SpriestSettings.myPrefs.insanity;
            comboBoxFromDarknessYorN.SelectedIndex = SpriestSettings.myPrefs.DarknessLight;
            comboBoxMindBinderYorN.SelectedIndex = SpriestSettings.myPrefs.mindbender;
            comboBoxAngelicFeatherYorN.SelectedIndex = SpriestSettings.myPrefs.angelicfeather;
            comboBoxPsyFiendYorN.SelectedIndex = SpriestSettings.myPrefs.psyfiend;
            comboBoxVoidTendrilsYorN.SelectedIndex = SpriestSettings.myPrefs.voidtendrils;
            comboBoxBeestje.SelectedIndex = SpriestSettings.myPrefs.beestje;
            comboBoxMindSearUse.SelectedIndex = SpriestSettings.myPrefs.usemindsear;
            comboBoxPsychicScreamUse.SelectedIndex = SpriestSettings.myPrefs.psyscream;
            comboBoxSilence.SelectedIndex = SpriestSettings.myPrefs.silence;
            comboBoxJadeSerpent.SelectedIndex = SpriestSettings.myPrefs.JadeSerpent;
            comboBoxIntellectFlask.SelectedIndex = SpriestSettings.myPrefs.IntellectFlask;
            comboBoxdesperatePrayerYorN.SelectedIndex = SpriestSettings.myPrefs.DesperatePrayerYorN;
            comboBoxPauseKey.SelectedIndex = SpriestSettings.myPrefs.PauseKey;
            switch (SpriestSettings.myPrefs.PauseKey)
            {
                case 0:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.None;
                    break;
                case 1:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.LCTRL;
                    break;
                case 4:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.RCTRL;
                    break;
                case 5:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.LALT;
                    break;
                case 6:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.RALT;
                    break;
            }
            comboBoxStopAoeKey.SelectedIndex = SpriestSettings.myPrefs.StopAoeKey;
            switch (SpriestSettings.myPrefs.StopAoeKey)
            {
                case 0:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.None;
                    break;
                case 1:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.LCTRL;
                    break;
                case 4:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.RCTRL;
                    break;
                case 5:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.LALT;
                    break;
                case 6:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.RALT;
                    break;
            }

            checkBoxMovement.Checked = SpriestSettings.myPrefs.movement;
            checkBoxFacing.Checked = SpriestSettings.myPrefs.facing;
            checkBoxTargetting.Checked = SpriestSettings.myPrefs.targetting;
            checkBoxPullDevPlag.Checked = SpriestSettings.myPrefs.pullDevPlag;
            checkBoxFearWard.Checked = SpriestSettings.myPrefs.FearWard;


            numericUpDownTendrilsAdds.Value = new decimal(SpriestSettings.myPrefs.tendriladds);
            numericUpDownDispersionHealthPercent.Value = new decimal(SpriestSettings.myPrefs.dispersionhealth);
            numericUpDownDispersionManaPercent.Value = new decimal(SpriestSettings.myPrefs.dispersionmana);
            numericUpDownBeestjeManaPercent.Value = new decimal(SpriestSettings.myPrefs.beestjepercent);
            numericUpDownOrbs.Value = new decimal(SpriestSettings.myPrefs.shadoworbs);
            numericUpDownPsychicAdds.Value = new decimal(SpriestSettings.myPrefs.psyscreamadds);
            numericUpDownDesperatePrayer.Value = new decimal(SpriestSettings.myPrefs.DesperatePrayerPercent);
            numericUpDownPowerWordShield.Value = new decimal(SpriestSettings.myPrefs.PowerWordShieldPercent);
            numericUpDownFlashHeal.Value = new decimal(SpriestSettings.myPrefs.FlashHealPercent);
            numericUpDownRenew.Value = new decimal(SpriestSettings.myPrefs.RenewPercent);
            numericUpDownHealthstone.Value = new decimal(SpriestSettings.myPrefs.HealthstonePercent);
            numericUpDownEngibelt.Value = new decimal(SpriestSettings.myPrefs.engibeltpercent);
            numericUpDownNaruu.Value = new decimal(SpriestSettings.myPrefs.naruupercent);
            numericUpDownDrinkMana.Value = new decimal(SpriestSettings.myPrefs.drinkmana);
            numericUpDownEatFood.Value = new decimal(SpriestSettings.myPrefs.eatfood);
            numericUpDownFlashHealOOC.Value = new decimal(SpriestSettings.myPrefs.FlashHealPercentOOC);
            numericUpDownRenewOOC.Value = new decimal(SpriestSettings.myPrefs.RenewPercentOOC);
            numericUpDownVampiricEmbrace.Value = new decimal(SpriestSettings.myPrefs.VampiricEmbracePercent);
            numericUpDownStartAoe.Value = new decimal(SpriestSettings.myPrefs.startaoe);


        }

        private void button1_Click(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.Save();
            Close();
        }

        private void comboBoxTrinket1_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.trinket1 = comboBoxTrinket1.SelectedIndex;
        }

        private void comboBoxTrinket2_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.trinket2 = comboBoxTrinket2.SelectedIndex;
        }

        private void comboBoxEngiGloves_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.engigloves = comboBoxEngiGloves.SelectedIndex;
        }

        private void comboBoxAlchemyFlask_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.alchemyflask = comboBoxAlchemyFlask.SelectedIndex;
        }

        private void comboBoxPowerInfusionYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.powerinfusion = comboBoxPowerInfusionYorN.SelectedIndex;
        }

        private void comboBox1Powerinfusion_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.usepowerinfusion = comboBox1Powerinfusion.SelectedIndex;
        }

        private void comboBoxCascadeYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.cascade = comboBoxCascadeYorN.SelectedIndex;
        }

        private void comboBoxCascade_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.usecascade = comboBoxCascade.SelectedIndex;
        }

        private void comboBoxDivineStarYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.divinestar = comboBoxDivineStarYorN.SelectedIndex;
        }

        private void comboBoxDivineStar_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.usedivinestar = comboBoxDivineStar.SelectedIndex;
        }

        private void comboBoxHaloYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.halo = comboBoxHaloYorN.SelectedIndex;
        }

        private void comboBox1Halo_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.usehalo = comboBox1Halo.SelectedIndex;
        }

        private void comboBoxInsanityYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.insanity = comboBoxInsanityYorN.SelectedIndex;
        }

        private void comboBoxFromDarknessYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.DarknessLight = comboBoxFromDarknessYorN.SelectedIndex;
        }

        private void comboBoxMindBinderYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.mindbender = comboBoxMindBinderYorN.SelectedIndex;
        } 

        private void comboBoxAngelicFeatherYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.angelicfeather = comboBoxAngelicFeatherYorN.SelectedIndex;
        }

        private void comboBoxPsyFiendYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.psyfiend = comboBoxPsyFiendYorN.SelectedIndex;
        }

        private void comboBoxVoidTendrilsYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.voidtendrils = comboBoxVoidTendrilsYorN.SelectedIndex;
        }

        private void numericUpDownTendrilsAdds_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.tendriladds = (int)numericUpDownTendrilsAdds.Value;
        }

        private void numericUpDownDispersionHealthPercent_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.dispersionhealth = (int)numericUpDownDispersionHealthPercent.Value;
        }

        private void numericUpDownDispersionManaPercent_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.dispersionmana = (int)numericUpDownDispersionManaPercent.Value;
        }

        private void numericUpDownBeestjeManaPercent_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.beestjepercent = (int)numericUpDownBeestjeManaPercent.Value;
        }

        private void comboBoxBeestje_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.beestje = comboBoxBeestje.SelectedIndex;
        }

        private void comboBoxMindSearUse_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.usemindsear = comboBoxMindSearUse.SelectedIndex;
        }

        private void numericUpDownOrbs_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.shadoworbs = (int)numericUpDownOrbs.Value;
        }

        private void comboBoxPsychicScreamUse_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.psyscream = comboBoxPsychicScreamUse.SelectedIndex;
        }

        private void numericUpDownPsychicAdds_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.psyscreamadds = (int)numericUpDownPsychicAdds.Value;
        }

        private void comboBoxSilence_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.silence = comboBoxSilence.SelectedIndex;
        }

        private void checkBoxMovement_CheckedChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.movement = checkBoxMovement.Checked;
        }

        private void checkBoxFacing_CheckedChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.facing = checkBoxFacing.Checked;
        }

        private void checkBoxTargetting_CheckedChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.targetting = checkBoxTargetting.Checked;
        }

        private void numericUpDownDesperatePrayer_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.DesperatePrayerPercent = (int)numericUpDownDesperatePrayer.Value;
        }

        private void numericUpDownPowerWordShield_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.PowerWordShieldPercent = (int)numericUpDownPowerWordShield.Value;
        }

        private void numericUpDownFlashHeal_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.FlashHealPercent = (int)numericUpDownFlashHeal.Value;
        }

        private void numericUpDownRenew_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.RenewPercent = (int)numericUpDownRenew.Value;
        }

        private void numericUpDownHealthstone_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.HealthstonePercent = (int)numericUpDownHealthstone.Value;
        }

        private void numericUpDownEngibelt_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.engibeltpercent = (int)numericUpDownEngibelt.Value;
        }

        private void numericUpDownNaruu_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.naruupercent = (int)numericUpDownNaruu.Value;
        }

        private void numericUpDownDrinkMana_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.drinkmana = (int)numericUpDownDrinkMana.Value;
        }

        private void numericUpDownEatFood_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.eatfood = (int)numericUpDownEatFood.Value;
        }

        private void numericUpDownFlashHealOOC_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.FlashHealPercentOOC = (int)numericUpDownFlashHealOOC.Value;
        }

        private void numericUpDownRenewOOC_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.RenewPercentOOC = (int)numericUpDownRenewOOC.Value;
        }

        private void comboBoxJadeSerpent_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.JadeSerpent = comboBoxJadeSerpent.SelectedIndex;
        }

        private void comboBoxIntellectFlask_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.IntellectFlask = comboBoxIntellectFlask.SelectedIndex;
        }

        private void comboBoxdesperatePrayerYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.DesperatePrayerYorN = comboBoxdesperatePrayerYorN.SelectedIndex;
        }

        private void checkBoxPullDevPlag_CheckedChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.pullDevPlag = checkBoxPullDevPlag.Checked;
        }

        private void comboBoxPauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.PauseKey = comboBoxPauseKey.SelectedIndex;
            switch (comboBoxPauseKey.SelectedIndex)
            {
                case 0:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.None;
                    break;
                case 1:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.LCTRL;
                    break;
                case 4:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.RCTRL;
                    break;
                case 5:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.LALT;
                    break;
                case 6:
                    SpriestSettings.myPrefs.PauseKeys = SpriestSettings.Keypress.RALT;
                    break;
            }
        }

        private void comboBoxStopAoeKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.StopAoeKey = comboBoxStopAoeKey.SelectedIndex;
            switch (comboBoxStopAoeKey.SelectedIndex)
            {
                case 0:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.None;
                    break;
                case 1:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.LCTRL;
                    break;
                case 4:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.RCTRL;
                    break;
                case 5:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.LALT;
                    break;
                case 6:
                    SpriestSettings.myPrefs.StopAoeKeys = SpriestSettings.Keypress.RALT;
                    break;
            }
        }

        private void comboBoxLifebloodYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.lifebloodYorN = comboBoxLifebloodYorN.SelectedIndex;
        }

        private void comboBoxLifeblood_SelectedIndexChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.uselifeblood = comboBoxLifeblood.SelectedIndex;
        }

        private void numericUpDownVampiricEmbrace_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.VampiricEmbracePercent = (int)numericUpDownVampiricEmbrace.Value;
        }

        private void numericUpDownStartAoe_ValueChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.startaoe = (int)numericUpDownStartAoe.Value;
        }

        private void checkBoxFearWard_CheckedChanged(object sender, EventArgs e)
        {
            SpriestSettings.myPrefs.FearWard = checkBoxFearWard.Checked;
        }

         
    }
}
